data segment
  a db 1,1,1,1
    db 2,2,2,2
    db 3,3,3,3
  b db 1,1,1
    db 2,2,2
    db 3,3,3
    db 4,4,4
  m dw 3
  n dw 4
  y dw 0
  c db 9 dup(?)
data ends
code segment
    assume cs:code,ds:data
main proc far
start:mov ax,data
    mov ds,ax
    mov cx,m
    mov di,0
    mov si,0
rept3:
    push y
    push cx
    mov cx,m
    call subr1
    pop cx
    pop y
    add y,4
    loop rept3
    mov ah,4ch
    int 21h
main endp

subr1 proc near
    mov bp,sp
rept2:
    push cx
    mov bx,[bp+4]
    mov si,m
    sub si,cx
    mov cx,n
rept1:
    mov al,a[bx]
    mov dl,b[si]
    imul dl
    add c[di],al
    inc bx
    add si,3
    loop rept1
    inc di
    pop cx
    loop rept2
    ret
subr1 endp
code ends
    end start 